<template>
  <div>
    <van-index-anchor
      :index="index"
      :z-index="1"
      sticky
      :sticky-offset-top="0"
    />
    <van-cell
      :title="item.label ? item.label : item"
      v-for="item in item"
      :key="item.value"
      @click="itemFn(item)"
    />
  </div>
</template>

<script>
export default {
  props: ['item', 'index'],
  methods: {
    itemFn (item) {
      console.log(item.value)
      localStorage.setItem('newCity', item.label)
      localStorage.setItem('newCityCode', item.value)
      this.$router.replace({
        path: '/layout/search'
      })
    }
  }
}
</script>

<style>
</style>
